<template>
    <div class="us">
        <div class="us-wrapper">
            <div class="head-title">
                <h2>{{data.title}}</h2>
                <p>{{data.create_time}}</p>
            </div>
            <div class="content">
                <p>{{data.content}}</p>
            </div>
        </div>
		<div class="close" @click="_close">
			<img :src="icon" width="32" height="32" alt="">
		</div>
    </div>
</template>

<script>
import navbar from '@c/navbar/navbar'
import Button from '@c/button/button'
import icon from '@imgs/share/closepwd.png'
import { mapState, mapMutations } from 'vuex'
import { vpost, sonpost, fpost, gpost, vlink } from '@api/axios'
export default {
    name: 'Us',
    props: {
        id: {
            type: String,
        }
    },
	data() {
		return {
			data: {},
			icon,
		}
	},
	components: {
		'v-navbar': navbar,
		'v-button': Button,
	},
	computed: {
		...mapState(['wtitle', 'rback']),
	},
	methods: {
        ...mapMutations(['WTITLE', 'RBACK']),
        // 获得公告内容数据
		_getNoticeContent(id) {
			let noticeId = {
				searchKey: id
			}
			vpost(vlink.home.noticeContent, noticeId).then(re => {
				if (re.status === 0) {
					this.data = re.data[0]
				} else {
					this.$Message.warning(re.msg)
				}
			})
		},
		// 关闭
		_close() {
			this.$emit('close')
		}
	},
	watch: {
		'id'() {
			if (this.id === '') {
				return
			} else {
				this._getNoticeContent(this.id)
			}
		}
	}
}
</script>